package org.haredot.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.haredot.entity.User;

import java.util.List;
import java.util.Map;

@Mapper
public interface UserMapper {
    int deleteByPrimaryKey(Long id);

    int insert(User record);

    User selectByPrimaryKey(Long id);

    int updateByPrimaryKey(User record);

    List<User> findAll(Map<String, ?> params) ;

    List<Map<String, Object>> findDepartsRefUserId(@Param("userId") Long userId);

    int removeDepartsByUserId(Long userId);

    int batchDepartsInsert(@Param("userId") Long userId, @Param("departs") List<Long> departs);

    List<Map<String, Object>> findPositionsRefUserId(@Param("userId") Long userId);

    int removePositionsByUserId(Long userId);

    int batchPositionInsert(@Param("userId")Long userId, @Param("positions")List<Long> positions);

    List<Map<String, Object>> findRolesRefUserId(@Param("userId") Long userId);

    User findUserByUsername(String username);

    int deleteRolesByUserId(Long userId);

    int batchRoleInsert(@Param("userId") Long id, @Param("roles") List<Long> roles);

    List<Long> findDefaultRoleIds() ;

    int removeUserById(Long userId);
}